import request from '@/utils/request';
//接口三方面， 请求方式，请求url ,请求参数（query,params,body）

//搜索商品
const reqAddToCart= (skuId,skuNum) => {
  // console.log(searchParams);
  return request.post(`/api/cart/addToCart/${ skuId }/${ skuNum }`);
};

//购物车列表
const reqCartList= (skuId,skuNum) => {
  // console.log(searchParams);
  return request.get(`/api/cart/cartList`);
};

//8.切换商品选中状态
const reqCheckCart= (skuID,isChecked) => {
  return request.get(`/api/cart/checkCart/${skuID}/${isChecked}`);
};

//删除商品
const reqDelete= (skuId) => {
  return request.delete(`/api/cart/deleteCart/${skuId} `);
};
//20.批量选中购物车
const reqSelectAll= (isChecked,skuIdList) => {
  return request.post(`/api/cart/batchCheckCart/${isChecked} `,skuIdList);
};

// 21.批量删除购物车post
const reqDeleteChecked= (skuIdList) => {
  return request.post(`/api/cart/batchDeleteCart`,skuIdList);
};

export default {
    reqAddToCart,
    reqCartList,
    reqCheckCart,
    reqDelete,
    reqSelectAll,
    reqDeleteChecked
};